 <!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    

    <title>{$Think.config.site.title} - 退款审批</title>

    <meta name="keywords" content="{$Think.config.site.keywords}">

    <link href="{$Think.config.site.resource_url}css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/animate.min.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/style.min.css?v=4.0.0" rel="stylesheet">

</head>
<style>
#listtable .fa{
	cursor:pointer;
	color:#1ab394;
	margin-right:1em;
}
th .tag{font-size: 12px; color: #e66c6c; font-weight: normal;}
.ibox-title .tag{font-size: 12px; color: #e66c6c; font-weight: normal; display: inline-block; margin-left: 20px;}
.specval-hide{display: none;}
th,td{text-align: center;}
.select_sort{cursor: pointer;}
.text-r{text-align: right !important;}
.text-l{text-align: left !important;}
</style>
<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">

      <div class="row">
          <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>退款审批列表</h5>
                        <!-- <span class="tag">说明：</span> -->
                    </div>
                    <div class="ibox-content">
                        <div class="row">
                        	<div class="col-sm-6">
                        	</div>
                          	<div class="col-sm-6">
                                <div class="input-group pull-right">
									<form id="froms" name="myform" action="{:url('index')}" method="get" enctype="application/x-www-form-urlencoded">
										<div class="input-group">
											<input type="text" placeholder="收货人姓名/电话/订单号" class="input-sm form-control" value="{$Think.get.keywords ?? ''}" name="keywords">
											<input type="hidden" class="sort" name="sort" value="">
											<input type="hidden" class="sort_status" name="sort_status" value="">
											<span class="input-group-btn">
												<button type="submit" class="btn btn-sm btn-primary"> 搜索</button> </span>
										</div>
									</form>
                                </div>
                            </div>
                            
                        </div>
                        <div class="table-responsive">
                            <table class="table table-striped" id="listtable">
                                <thead>
                                    <tr>
                                        <th width="150">提交审核时间</th>
                                        <th  class="text-l">退款理由</th>
                                        <th width="150" class="text-r">退款金额</th>
                                        <th width="300">相关订单</th>
                                        <th width="300">操作</th>
                                    </tr>
                                </thead>
                                <tbody>

                                	{volist name="list" id="v"}
                                    {volist name="v['list']" id="vo"}
                                    <tr data-id="{$vo.audit_id}" data-order_id="{$vo.order.order_id}">
                                        <td>{$vo.create_time}</td>
                                        <td class="text-l">{$vo.remark}</td>
                                        <td class="text-r money">￥{$vo.money}</td>
                                        <td>{$vo.order.order_no} （后四位：{:substr($vo['order']['pay_no'],-4)}）<br/>{$vo.order.receiver_name} {$vo.order.receiver_mobile}</td>
                                        <td>
                                            <button class="btn btn-primary agree">通过</button>
                                            <i class="fa fa-edit refuse"> 拒绝</i>
                                            <button class="btn btn-primary detail">详情</button>
                                        </td>
                                    </tr>
                                    {/volist}
                                    <tr style="background: #f5abab" >
                                        <td colspan="2" class="text-r">{$v.time}号统计：</td>
                                        <td class="text-r">￥{$v.count}</td>
                                        <td></td>
                                        <td></td>
                                    </tr>
                                   {/volist}
                                </tbody>
                            </table>
                        </div>
                        <div>{$page}</div>
                    </div>
                </div>
            </div>

        </div>
    </div>

    <script src="{$Think.config.site.resource_url}js/jquery.min.js?v=2.1.4"></script>
    <script src="{$Think.config.site.resource_url}js/bootstrap.min.js?v=3.3.5"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/peity/jquery.peity.min.js"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/iCheck/icheck.min.js"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/layer/layer.js"></script>
    <script src="{$Think.config.site.common_resource_url}js/majax.js"></script>
    <script src="{$Think.config.site.common_resource_url}js/jedit.js"></script>
</body>

</html>
<script>

$('.agree').click(function(){
    var money = $(this).closest('tr').find('.money').text(),id = $(this).closest('tr').data('id');
    layer.confirm('审核通过将自动退款'+money+'元', {
            btn: ['确定','取消'], //按钮
            // shade: 0, //不显示遮罩
            title:'提示'
        }, function(){
            //确定删除
            majax('{:url("agree")}',{id:id},function(d){
                if (d.code>0) {
                    
                }else{
                    layer.msg(d.msg, {icon: 5});
                }
            })
        },
        function(){
            
        }
    );
})

$('.refuse').click(function(){
    var money = $(this).closest('tr').find('.money').text(),id = $(this).closest('tr').data('id');
    layer.confirm('确定拒绝此次退款申请？', {
            btn: ['确定','取消'], //按钮
            // shade: 0, //不显示遮罩
            title:'提示'
        }, function(){
            //确定删除
            majax('{:url("refuse")}',{id:id},function(d){
                if (d.code>0) {
                    
                }else{
                    layer.msg(d.msg, {icon: 5});
                }
            })
        },
        function(){
            
        }
    );
})

$('.detail').click(function(){
    var id = $(this).closest('tr').data('order_id');
    layer_font = layer.open({
        type: 2,
        title: '订单详情',
        shadeClose: true,
        shade: 0.8,
        area: ['80%', '90%'],
        content: '{:url("detail")}?id=' + id //iframe的url
    });
})
</script>